<?php 
include 'header.php'; 
?><br />&nbsp;<br />
		<span class="search">
<form name="searchform" id="searchform" action="<?=base_url()?>index.php/admin/products/search" method="post">
	<fieldset><legend>Search for&hellip;</legend>
		<input type="text" name="s" id="s" value="<?= isset($sticky) ? $sticky['s'] : '' ?>" size="17" />
	</fieldset>

	<fieldset><legend>Status&hellip;</legend>
		<select name='post_status'>
			<option <?= isset ($sticky) && $sticky['post_status'] == 'any' ? 'selected="selected"' : '' ?> value='any'>Any</option>
			<option <?= isset ($sticky) && $sticky['post_status'] == 'visible' ? 'selected="selected"' : '' ?> value='visible'>Visible</option>
			<option <?= isset ($sticky) && $sticky['post_status'] == 'invisible' ? 'selected="selected"' : '' ?> value='invisible'>Invisible</option>
		</select>
	</fieldset>


	<fieldset><legend>Month&hellip;</legend>
		<select name='m'>
			<option selected="selected" value='any'>Any</option>
			<option value='<?=date('Y')?>'>---<?=date('Y')?>---</option>
			<?php
				if (date('m') >= 12)
					echo "<option value='december" . date('Y') . "'>December " . date('Y') . "</option>";
				if (date('m') >= 11)
					echo "<option value='november" . date('Y') . "'>November " . date('Y') . "</option>";
				if (date('m') >= 10)
					echo "<option value='october" . date('Y') . "'>October " . date('Y') . "</option>";
				if (date('m') >= 9)
					echo "<option value='september" . date('Y') . "'>September " . date('Y') . "</option>";
				if (date('m') >= 8)
					echo "<option value='august" . date('Y') . "'>August " . date('Y') . "</option>";
				if (date('m') >= 7)
					echo "<option value='july" . date('Y') . "'>July " . date('Y') . "</option>";
				if (date('m') >= 6)
					echo "<option value='june" . date('Y') . "'>June " . date('Y') . "</option>";
				if (date('m') >= 5)
					echo "<option value='may" . date('Y') . "'>May " . date('Y') . "</option>";
				if (date('m') >= 4)
					echo "<option value='april" . date('Y') . "'>April " . date('Y') . "</option>";
				if (date('m') >= 3)
					echo "<option value='march" . date('Y') . "'>March " . date('Y') . "</option>";
				if (date('m') >= 2)
					echo "<option value='february" . date('Y') . "'>February " . date('Y') . "</option>";	
				if (date('m') >= 1)
					echo "<option value='january" . date('Y') . "'>January " . date('Y') . "</option>";
			?>
			<?php
			if (!empty($oldestyear)) {
			for ($i=date('Y')-1;$i>=$oldestyear;$i--) { ?>
			<option value='<?=$i?>'>---<?=$i?>---</option>
			<option value='december<?=$i?>'>December <?=$i?></option>
			<option value='november<?=$i?>'>November <?=$i?></option>
			<option value='october<?=$i?>'>October <?=$i?></option>
			<option value='september<?=$i?>'>September <?=$i?></option>
			<option value='august<?=$i?>'>August <?=$i?></option>
			<option value='july<?=$i?>'>July <?=$i?></option>
			<option value='june<?=$i?>'>June <?=$i?></option>
			<option value='may<?=$i?>'>May <?=$i?></option>
			<option value='april<?=$i?>'>April <?=$i?></option>
			<option value='march<?=$i?>'>March <?=$i?></option>
			<option value='february<?=$i?>'>February <?=$i?></option>		
			<option value='january<?=$i?>'>January <?=$i?></option>
			<?php }} ?>
			
		</select>
	</fieldset>


	<fieldset><legend>Category&hellip;</legend>
		<select name='cat' id='cat' class='postform'>
	<option value='all'>All Categories</option>
		<? foreach($categories as $category) {
                echo "<option value='" . $category->catid . "'>" . $category->tabs . $category->catname . "</option>";
        } ?>
</select>
	</fieldset>
	<fieldset>
	<input type="submit" id="post-query-submit" value="Filter &#187;" class="button" />
	</fieldset>
</form>
</span>

<div id="alertfader"></div>
<div id="content">
<form name="productsform" id="productsform" action="<?php echo base_url(); ?>index.php/admin/products/process" method="POST">
		<div id="buttons">
			
			<input type="submit" name="button" value="Delete" />
			<input type="submit" name="button" value="Make Invisible" />
			<input type="submit" name="button" value="Make Visible" />
			
			<span class="counts"><?php if (!empty($pagination)) {
					$lastnum = $offset + 10;
					$lastnum = min($lastnum, $numitems);
					if ($offset == 0) $offset = 1;
					echo '<span style="font-size: 10pt; margin-right: 20px">';
					echo "Displaying <b>" .$offset . "</b> to <b>" . $lastnum . "</b> out of <b>" . $numitems . "</b> items";
					echo '</span>';
					echo $pagination;
					
			} ?></span>
			<br />&nbsp;<br /><span style="display: none;" id="selecting">Select: <span id="selall"><a href="#" onclick="return false" style="color: black">All</a></span>, <span id="selnone"><a href="#" onclick="return false" style="color: black">None</a></span>
			</span>

		</div>

<?php if (!empty($message)) { ?><div id="alert"><?php echo $message; ?></div><?php } ?>


<table cellspacing=0 ><tbody id="the-list">
	<?php if (!empty($items)) { foreach ($items as $item) { ?>
			<tr>	
		<td><input id="select_<?php echo $item->id; ?>" name="checkall[<?=$item->id?>]" value="<?php echo $item->id; ?>" type="checkbox" /></td>

		<td class="date <?php if ($item->invisible) { echo 'invisible'; } ?>"><?php echo $item->date; ?></td>
				<td class="itemtitle <?php if ($item->invisible) { echo 'invisible'; } ?>"><?php echo anchor("/admin/product/" . $item->id,$item->title); ?>  <?php if ($item->invisible) { echo '(Invisible)'; } ?></td>
				<td class="author <?php if ($item->invisible) { echo 'invisible'; } ?>" style="text-align: right; padding-right: 25px">$<?php echo number_format($item->price,2); ?></td>
				<td><a href="<?php echo base_url(); ?>index.php/product/<?php echo $item->id; ?>" title="View Item"><img src='<?php echo base_url(); ?>images/view.png' alt='view' /></a></td>
				<td><a href="<?php echo base_url(); ?>index.php/admin/product/edit/<?php echo $item->id; ?>" title="Edit Item"><img src='<?php echo base_url(); ?>images/edit.png' alt='edit' /></a></td></td>
		<!--td><a href="<?php echo base_url(); ?>index.php/admin/product/delete/<?php echo $item->id; ?>" onclick="return false" title="Delete Item"><img src='<?php echo base_url(); ?>images/delete.png' alt='delete' /></a></td-->	
		</tr>
	<?php }} ?>
			

			
<input type='hidden' name='offset' id='offset' value=<?php echo $offset; ?> />
</tbody>
</table>
</form>
<?php
include 'footer.php';
?>